USE [comunion]
GO
/****** Object:  StoredProcedure [dbo].[rsp_Transaction_OR]    Script Date: 08/11/2010 15:24:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO



--exec rsp_Transaction_OR 'OR-1000001','ASC'
--Stored Procedure for Transactional Printout (Official Receipt)
ALTER PROCEDURE [dbo].[rsp_Transaction_OR]
	@cTranNo VARCHAR(25),
	@cCompID VARCHAR(10)

AS 

	SELECT A.cTranNo, A.dDate, A.cCode, B.cName, B.cAddress, A.nPDC, A.nCash, A.nEWT, A.nInvTotal, A.nPaytotal, A.nOthersTotal, b.cTIN, D.cInvNo,  
	D.nTaxBase, A.nEVAT
	FROM PR A
	LEFT JOIN PR_C C ON A.cTranNo = C.cTranNo AND A.cCompanyID = C.cCompanyID
	LEFT JOIN CLIENT_CUSTOMER B ON A.cCode = B.cCode AND A.cCompanyID = B.cCompanyID
	LEFT JOIN pr_t D ON A.cTranNo = D.cTranNo AND A.cCompanyID = D.cCompanyID
	
	WHERE A.cTranNo = @cTranNo AND A.cCompanyID = @cCompID
	GROUP BY c.cTranNo,A.cTranNo, A.dDate, A.cCode, B.cName, B.cAddress, A.nPDC, A.nCash, A.nEWT, A.nInvTotal, A.nPaytotal, A.nOthersTotal, b.cTIN, D.cInvNo, 
	D.nTaxBase, A.nEVAT



